package com.vilyever.socketclient.helper;

import com.vilyever.socketclient.SocketClient;

/**
 * SocketClientReceivingDelegate
 * Created by vilyever on 2016/5/30.
 * Feature:
 */
public interface SocketClientReceivingDelegate {
    /**
     * 开始接受一个新的数据包时的回调
     */
    void onReceivePacketBegin(SocketClient client, SocketResponsePacket packet);

    /**
     * 完成接受一个新的数据包时的回调
     */
    void onReceivePacketEnd(SocketClient client, SocketResponsePacket packet);

    /**
     * 取消接受一个新的数据包时的回调
     * 在断开连接时会触发
     */
    void onReceivePacketCancel(SocketClient client, SocketResponsePacket packet);

    /**
     * 接受一个新的数据包的进度回调
     * progress值为[0.0f, 1.0f]
     * 仅作用于ReadStrategy为AutoReadByLength的自动读取
     * 因AutoReadByLength可以首先接受到剩下的数据包长度
     */
    void onReceivingPacketInProgress(SocketClient client, SocketResponsePacket packet, float progress, int receivedLength);
}
